class Solution {
public:
    int missingNumber(vector<int>& nums) {
       int  numsSize = nums.size();
    sort(nums.begin(),nums.end());
    vector<int> a(numsSize+1);
    for(int i = 0; i<=numsSize;i++)
    {
a[i] = i;
    }
    for(int i = 0;i<=numsSize;i++)
    {
        if(i == numsSize||a[i]!=nums[i]) return i;
    }
    return -1;
    }
};

